import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: 'admin/products',
    method: 'get',
    params: query
  })
}

export function show(id, query) {
  return request({
    url: '/admin/products/' + id,
    method: 'get',
    params: query
  })
}

export function create(data) {
  return request({
    url: '/admin/products/store',
    method: 'post',
    data: data
  })
}

export function update(data, id) {
  return request({
    url: '/admin/products/' + id,
    method: 'put',
    data: data
  })
}

export function coverUpload(data) {
  return request({
    url: '/admin/products/uploadpic',
    method: 'post',
    data: data
  })
}

// console.log(process.env.BASE_API)
